package com.xmy.study.util;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ConfigData {

    public static String[] getQuarterArr(){
        String[] quarterNameArr = {"无","寒","春","暑","秋"};
        return quarterNameArr;
    }

    public static String getQuarterForNum(Integer num){
        String[] quarterNameArr = {"无","寒","春","暑","秋"};
        return quarterNameArr[num];
    }

    public static String getYearClassForNum(Integer num){
        String[] yearClassArr = {"幼儿园","一年级","二年级","三年级","四年级","五年级","六年级","初一","初二","初三","高一","高二","高三"};
        return yearClassArr[num];
    }

    public static String getSubjectsNameForNum(Integer num){
        String[] yearClassArr = {"","英语","数学","物理"};
        return yearClassArr[num];
    }

    /**
     *获取下一个季度
     * @param yearPart
     * @param num
     * @return
     */
    public static Map<String,Integer> getNextQuarter(int yearPart, int num){
        Map<String,Integer> map = new HashMap<>();
        int newYearPart = yearPart;
        int newNum = num+1;
        if(newNum>4){
            newNum = 1;
            newYearPart = newYearPart+1;
        }
        map.put("yearPart",newYearPart);
        map.put("num",newNum);
        return map;
    }

    /**
     * 返回id
     * @param name
     * @return
     */
    public static Integer getUnionLearnModeTypeId(String name){
        String[] dataArr = {"","学习","查漏补缺","查漏补缺（英译中）","查漏补缺（中译英）","学习（拼读）","查漏补缺（拼读）"};
        Integer res = 0;
        Integer i = 0;
        for (String str:dataArr){
            if (str.equals(name)){
                res = i;
                break;
            }
            i++;
        }
        return res;
    }

    public static String getUnionLearnModeTypeName(Integer id){
        String[] dataArr = {"","学习","查漏补缺","查漏补缺（英译中）","查漏补缺（中译英）","学习（拼读）","查漏补缺（拼读）"};
        String res = "";
        Integer i = 0;
        for (String str:dataArr){
            if (i.equals(id)){
                res = str;
                break;
            }
            i++;
        }
        return res;
    }
    /**
     * 获取合并的学习类型数据
     * @return
     */
    public static List<Map<Integer,String>> getUnionLearnModeTypeList(){
        String[] dataArr = {"","学习","学习(拼读)","查漏补缺","查漏补缺（英译中）","查漏补缺（中译英）","查漏补缺（拼读）"};
        List<Map<Integer,String>> list = new ArrayList<>();
        Integer i = 0;
        for (String str:dataArr){
            if (StringUtils.isNotBlank(str)){
                Map<Integer,String> map = new HashMap<>();
                map.put(i,str);
                list.add(map);
            }
            i++;
        }
        return list;
    }
}
